<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class shopController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $products = [
            1=>['id'=>1,'name'=>'精灵女王','price'=>'9.9','des'=>'美丽妖艳'],
            2=>['id'=>2,'name'=>'梦幻熊猫','price'=>'19.9','des'=>'国宝'],
            3=>['id'=>3,'name'=>'风景','price'=>'29.9','des'=>'大雪纷飞'],
        ];
        return view('shop',['products'=>$products]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
    //添加到购物车
    public function addcart($id)
    {
        $products = [
            1=>['id'=>1,'name'=>'精灵女王','price'=>'9.9','des'=>'美丽妖艳'],
            2=>['id'=>2,'name'=>'梦幻熊猫','price'=>'19.9','des'=>'国宝'],
            3=>['id'=>3,'name'=>'风景','price'=>'29.9','des'=>'大雪纷飞'],
        ];
        $product = $products['id'];
    }
}
